package com.example.principle.config;

import com.example.principle.model.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.web.context.annotation.ApplicationScope;
import org.springframework.web.context.annotation.RequestScope;
import org.springframework.web.context.annotation.SessionScope;

@Configuration
public class UserConfig {
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
    public User singletonUser() {
        return new User();
    }

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public User prototypeUser() {
        return new User();
    }

    @Bean
    @RequestScope
    public User requestUser() {
        return new User();
    }

    @Bean
    @SessionScope
    public User sessionUser() {
        return new User();
    }

    @Bean
    @ApplicationScope
    public User applicationUser() {
        return new User();
    }
}
